package com.jiyun.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jiyun.common.pojo.Goods;
import com.jiyun.common.pojo.Sales;
import com.jiyun.mapper.GoodsMapper;
import com.jiyun.mapper.SalesMapper;
import com.jiyun.service.SalesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SalesServiceImpl implements SalesService {
    @Autowired
    private SalesMapper salesMapper;
    @Autowired
    GoodsMapper goodsMapper;
    @Override
    public PageInfo<Sales> findPage(Integer page, Integer pageSize, Sales sales) {
        PageHelper.startPage(page, pageSize);
        List<Sales> salesList = salesMapper.findPage(sales);
        PageInfo<Sales> pageInfo = new PageInfo<>(salesList);
        return pageInfo;
    }

    @Override
    public void save(Sales sales) {
        salesMapper.save(sales);
    }

    @Override
    public void update(Sales sales) {
        salesMapper.update(sales);
    }

    @Override
    public List<Goods> findGoods() {
        return goodsMapper.findGoods();
    }
}
